package spm.entities;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

/**
 * This is a persistent class used by Hibernate. The class represents a role in
 * the ACL. There are two types of roles: the global and the custom.
 * 
 * Global roles are builtin and can't be changed. These roles are not connected
 * with any project.
 * 
 * Custom roles are being created by users and always connected with particular
 * project.
 * 
 * @author Evgeny Ryzhkov
 * 
 * $Id: Role.java 11 2006-12-04 15:04:58Z evgeny.ryzhkov $
 * 
 */
public class Role {

	/**
	 * The unique ID of the role.
	 */
	private Long id;

	/**
	 * The name of the custom role.
	 */
	private String roleName;

	/**
	 * The key in the resource file for the global role name.
	 */
	private String roleNameKey;

	/**
	 * The date the role was created.
	 */
	private Date createDate;

	/**
	 * Comments for the role.
	 */
	private String comments;

	/**
	 * The type of the role.
	 */
	private RoleType roleType;

	/**
	 * Privileges of the role.
	 */
	private Set privileges = new HashSet();

	/**
	 * Constructor without parameters. It is required by Hibernate.
	 */
	public Role() {
	}

	/**
	 * @return Returns the comments.
	 */
	public String getComments() {
		return comments;
	}

	/**
	 * @param comments
	 *            The comments to set.
	 */
	public void setComments(String comments) {
		this.comments = comments;
	}

	/**
	 * @return Returns the createDate.
	 */
	public Date getCreateDate() {
		return createDate;
	}

	/**
	 * @param createDate
	 *            The createDate to set.
	 */
	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	/**
	 * @return Returns the id.
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id
	 *            The id to set.
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return Returns the roleName.
	 */
	public String getRoleName() {
		return roleName;
	}

	/**
	 * @param roleName
	 *            The roleName to set.
	 */
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}

	/**
	 * @return Returns the roleNameKey.
	 */
	public String getRoleNameKey() {
		return roleNameKey;
	}

	/**
	 * @param roleNameKey
	 *            The roleNameKey to set.
	 */
	public void setRoleNameKey(String roleNameKey) {
		this.roleNameKey = roleNameKey;
	}

	/**
	 * @return Returns the roleType.
	 */
	public RoleType getRoleType() {
		return roleType;
	}

	/**
	 * @param roleType
	 *            The roleType to set.
	 */
	public void setRoleType(RoleType roleType) {
		this.roleType = roleType;
	}

	/**
	 * @return Returns the privileges.
	 */
	public Set getPrivileges() {
		return privileges;
	}

	/**
	 * @param privileges
	 *            The privileges to set.
	 */
	public void setPrivileges(Set privileges) {
		this.privileges = privileges;
	}

}
